var wddhInterface = function(){
  var ywy  = manager.findParamFromUrl('ywy') ? manager.findParamFromUrl('ywy'):'000000';//业务域（先写死）
  function load(){
	  var data = [{
			name: 'dhrq',
			colNames:'Exchange time',
			width: 204,
			innerhtml: function(opts) {
	         return '<div>'+moment(opts.dhsj).format("YYYY-MM-DD HH:mm:ss")+'</div>'
			}
		}, {
			name: 'lpmc',
			width: 256,
			textAlign:'left',
			float:'left'
		}, {
			name: 'jf',
			width: 153
		}, {
			name: 'sfxnDesc',
			width: 129
		}, {
			name: 'dhzt',
			width: 227,
			innerhtml:function(opts){
				var ckwl = '';
				if(opts.shfs == Constants.SHFS.SHFS_KD && opts.dhztDesc == '已发放'){
					ckwl = 'View Logistics'
				}
				return '<span class=\'dhzt\'>'+opts.dhztDesc+'</span><span class=\'ckwl\' onclick=\'wddhInterface.wlgz("'+ opts.id +'")\'>'+ ckwl + '</span>'
			}
		}];
		var postData = {
				'currPage':1,
				"pageSize":20,
				"ywy":ywy
		};   
		// 绘制出关联设置信息列表
		$("#wd-table").wdGrid({
			url: Constants.csUrlPath + 'lpdh/getWddhPagination',
			colNames:['Exchange time','Product name','Price (score)','Virtual gift','Exchange status'],
			colModel: data,
			dataType: "GET",
			async: false,
			submitType: "noForm",
			postData:postData,
			checkflg: false,
			pager: "#wd-pager",
			rowList:  Constants.page.rowList,
			pagesize: Constants.page.pagesize
		});  
  }
    //物流跟踪
    function wlgz(dhid){
		var wlgzDialog = {
    			url: "../wlgz/wlgz.html?dhid="+dhid,
    			title: 'Logistics tracking',
    			width: "630",
    			height: "400",
    			successCallBackFun: function(){
    				wdDialogClosed("dialog");
    			}
    		}
    		var wlgzWin = dialog(wlgzDialog);
    }
    return {
    	init : function() {
			load();
		},
		wlgz : function(dhid) {
			wlgz(dhid);
		}
	}
}();
$(document).ready(wddhInterface.init);